﻿Imports BUS

Public Class frmTuyChon

    Private frmcho As DevExpress.Utils.WaitDialogForm

    Private Sub frmTuyChon_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim dt As New DataTable
        dt = BoPhanBus.LayDanhSach()

        Dim dr As DataRow = dt.NewRow
        dr("tenbp") = "Tất cả"
        dr("mabp") = 0

        dt.Rows.Add(dr)
        Dim dv As New DataView
        dv = dt.DefaultView
        dv.Sort = "mabp asc"
        dt = dv.ToTable

        cbobophan.DataSource = dt
        cbobophan.DisplayMember = "tenbp"
        cbobophan.ValueMember = "mabp"
    End Sub

    Private Sub btndongy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndongy.Click
        Dim sql As String = "exec sp_chamcongthangnhanvien " & nudthang.Value & ", " & nudnam.Value & ", N'" & cboloaicong.Text & "', '" & cbobophan.SelectedValue & "'"
        frmcho = New DevExpress.Utils.WaitDialogForm("Vui lòng chờ", "Đang xử lý")
        Dim rpt As New rptChamCongThang
        rpt.xrlTieuDe.Text = "BẢNG CHẤM CÔNG T" & nudthang.Value & " - " & nudnam.Value
        rpt.DataSource = ProcFuncBus.ExecuteFuncSQL(sql)
        rpt.CreateDocument()
        rpt.ShowPreview()
        frmcho.Close()

    End Sub
End Class